<template>
	<view>
		<view class="refund_top">
			<view v-show="setpCurrent != 5">
				<uni-steps :options="numList" :active="setpCurrent"></uni-steps>
			</view>
			<view class="refund_amount"  v-show="setpCurrent != 5">
				<view class="widths">
					<text class="amounts">{{status}}</text>
				</view>
				<view>
					<text :class="['logistics',setpCurrent>1? 'selectlogistics':'']">{{mar}}</text>
					<uni-icons v-show="setpCurrent>1" class="arrowr" type="arrowright"></uni-icons>
				</view>
			</view>
			<view class="fives" v-show="setpCurrent==5">卖家拒绝退货</view>
			<view class="refund_for" v-show="setpCurrent == 4">
				<text class="for_amounts">退款金额</text>
				<text class="for_moneys">¥2839.92</text>
			</view>
			<view class="shop_infor" :style="{'margin-top':(setpCurrent==5?'70rpx':'')}">
				<image src="" mode=""></image>
				<text class="infor_title">Microsoft Xbox one S专业游戏玩家机 1TB</text>
				<text class="infor_type">电子数码｜游戏机</text>
				<text class="infor_money">¥2839.92</text>
				<text class="infor_num">x1</text>
			</view>
		</view>
		<view class="reason" :style="{'margin-top':tops}">
			<text class="reason_title">退货理由</text>
			<text class="reason_type">退款退货 · 不想要了</text>
			<text class="reason_content">这里是详细描述这里是详细描述这里是详细描述这里是详细
				描述这里是详细描述</text>
			<view class="reason_img">
				<image src="" mode=""></image>
				<image src="" mode=""></image>
				<image src="" mode=""></image>
			</view>
		</view>
		<view class="operation_log">
			<view>
				<text class="log_name">操作日志</text>
				<text class="log_seller">联系卖家</text>
			</view>
			<view class="log_line">订单编号：TH373838393930232</view>
			<view class="log_line">申请时间：2020.12.12 12:30:33</view>
			<view class="log_line del">同意时间：2020.12.12 12:30:33</view>
			<view class="log_line del">快递单号：TH373838393930232</view>
			<view class="log_line del">快递公司：百世快递</view>
			<view class="log_line del">提交时间：2020.12.12 12:30:33</view>
			<view class="log_line del">
				<text>退货地址：</text>
				<text class="del" style="width: 500rpx;float: right;">这里是退货地址这里是退货地址这里是退货地址这里是退货地址这里</text>
			</view>
			<view class="log_line del">收货人：张三</view>
			<view class="log_line del">联系电话：186 6688 8899</view>
		</view>
		<view v-show="setpCurrent==0 || setpCurrent==1 || setpCurrent==5" style="width: 750rpx;height: 126rpx;background: #F5F5F5;">
		</view>
		<view class="bottoms" v-show="setpCurrent==0 || setpCurrent==1">
			<button class="btn" @click="btn(setpCurrent)">{{btnname}}</button>
		</view>
		<view class="bottoms" v-show="setpCurrent==5">
			<button class="customer_service">客服介入</button>
			<button class="again" @click="return_request">再次申请</button>
		</view>
		<uni-popup type="bottom" ref="addr">
			<view class="addrs">
				<view class="tops">
					<text>输入快递单号</text>
					<image @click="close" src="/static/me/clode.png" mode=""></image>
				</view>
				<uni-combox class="comboxs" :candidates="kdgs" placeholder="选择快递公司" @input="kds"></uni-combox>
				<input class="comboxs puts" v-model="kddh" type="text" placeholder="输入快递单号" />
				<view class="addr_name">退货地址</view>
				<view class="addr_details">这里是详细地址这里是详细地址这里是详细地址这里是详细地址这里是详细地址这里是详细地址</view>
				<view class="addr_infor">张三 186 6688 8899</view>
				<button class="btn" @click="OrderDeliver">确认已发货</button>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				kdgs: [],
				kdinformation:[],
				//步骤条的步数1-3
				numList: [{
					title: '申请退货'
				}, {
					title: '卖家同意退货'
				}, {
					title: '已发货'
				}, {
					title: '卖家已收货'
				}, {
					title: '已退款'
				}],
				// 发货快递
				fhkd:'',
				kdcode:'',
				kddh:'',
				//步骤条的步数进度
				setpCurrent: '',
				// 一个按钮显示的文字
				btnname: '撤回申请',
				// 第一个白色标题
				status: '已提交退货申请',
				// 第二个白色标题
				mar:'暂时无法获取到物流信息',
				tops:'532rpx'
			}
		},
		onLoad(parameter) {
			this.setpCurrent = parameter.pages
			if (this.setpCurrent == 0) {
				this.tops='409rpx'
				this.btnname = '撤回申请'
				this.status = '已提交退货申请'
				this.mar='暂时无法获取到物流信息'
			} else if (this.setpCurrent == 1) {
				this.tops='409rpx'
				this.btnname = '填写地址'
				this.status = '卖家同意发货'
				this.mar='暂时无法获取到物流信息'
				this.getKuaidiList()
			} else if (this.setpCurrent == 2) {
				this.tops='409rpx'
				this.status = '买家已发货'
				this.mar='中通快递 ZT081829382938'
			}else if(this.setpCurrent == 3){
				this.tops='409rpx'
				this.status = '卖家已收货'
				this.mar='中通快递 ZT081829382938'
			}else if(this.setpCurrent == 4){
				this.tops='532rpx'
				this.status = '已退款'
				this.mar='中通快递 ZT081829382938'
			}else if(this.setpCurrent == 5){
				this.tops='192rpx'
			}
		},
		methods: {
			kds(e){
				this.kdinformation.forEach((el)=>{
					if(el.kuaidiName == e){
						this.fhkd=el.kuaidiName
						this.kdcode=el.kuaidiCode
					}
				})
			},
			// 获取快递公司信息
			getKuaidiList(){
				var that = this
				that.$http.req.ajax({
					path: ':8090/web/kuaidi/getKuaidiList',
					header: {
						'token': uni.getStorageSync('token')
					},
					data: {
						pageNum: 1,
						pageSize:100
					},
					afterAjax: (res) => {
						console.log(res, '快递公司')
						this.kdinformation=res.data
						this.kdinformation.forEach((el)=>{
							this.kdgs.push(el.kuaidiName)
						})
						
					}
				})
			},
			// 确认已发货
			OrderDeliver(){
				var that = this
				that.$http.req.ajax({
					path: ':8090/web/idleOrders/idleOrderDeliver',
					header: {
						'token': uni.getStorageSync('token')
					},
					data: {
						orderId: 1,
						kdName:that.fhkd,
						kdCode:that.kdcode,
						kdNumber:that.kddh,
					},
					afterAjax: (res) => {
						console.log(res, '快递公司')
						this.kdinformation=res.data
						this.kdinformation.forEach((el)=>{
							this.kdgs.push(el.kuaidiName)
						})
						
					}
				})
			},
			btn(i) {
				if (i == 1) {
					this.$refs.addr.open()
				}
			},
			close() {
				this.$refs.addr.close()
			},
			return_request(){
				uni.navigateTo({
					url: 'return_request'
				})
			}
		}
	}
</script>

<style>
	page {
		background: #F5F5F5;
	}

	.refund_top {
		width: 750rpx;
		height: 230rpx;
		background: #FCDA22;
	}

	.shop_infor {
		width: 699rpx;
		height: 257rpx;
		background: #FFFFFF;
		opacity: 1;
		border-radius: 14rpx;
		margin: auto;
		margin-top: 25rpx;
	}

	.shop_infor image {
		width: 206rpx;
		height: 206rpx;
		margin: 25rpx;
		float: left;
		background: #EEEEEE;
		border-radius: 14rpx;
	}

	.infor_title {
		width: 416rpx;
		height: 72rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 500;
		line-height: 36rpx;
		color: #21201D;
		opacity: 1;
		margin-top: 25rpx;
		margin-bottom: 21rpx;
		float: left;
	}

	.infor_type {
		width: 416rpx;
		height: 30rpx;
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 30rpx;
		color: #21201D;
		opacity: 0.35;
		margin-bottom: 45rpx;
		float: left;
	}

	.infor_money {
		width: 200rpx;
		height: 36rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 500;
		line-height: 36rpx;
		color: #21201D;
		opacity: 1;
		float: left;
	}

	.infor_num {
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #999999;
		opacity: 1;
		float: right;
		margin-right: 25rpx;
	}

	.refund_amount {
		width: 699rpx;
		height: 184rpx;
		background: #FFFFFF;
		opacity: 1;
		border-radius: 18rpx;
		margin: auto;
		margin-top: 43rpx;
	}

	.amounts {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		line-height: 105rpx;
		color: #21201D;
		opacity: 1;
	}

	.logistics {
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 0.35;
		display: block;
		margin-left: 25rpx;
		margin-top: 21rpx;
	}

	.selectlogistics {
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #2B9CEF;
		opacity: 1;
		display: block;
		margin-left: 25rpx;
		margin-top: 21rpx;
	}

	.moneys {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #EB3E3E;
		opacity: 1;
		line-height: 101rpx;
		margin-right: 25rpx;
		float: right;
	}

	.reason {
		width: 706rpx;
		height: 318rpx;
		background: #FFFFFF;
		opacity: 1;
		border-radius: 18rpx;
		margin: auto;
		margin-top: 409rpx;
	}

	.reason_title {
		width: 426rpx;
		margin-left: 21rpx;
		padding-top: 25rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 1;
		overflow: hidden;
		float: left;
	}

	.reason_type {
		float: right;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 1;
		padding-top: 27rpx;
		margin-right: 21rpx;
	}

	.reason_content {
		width: 663rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 1;
		display: block;
		float: left;
		margin-left: 21rpx;
		margin-top: 25rpx;
	}

	.reason_img {
		margin-left: 7rpx;
		margin-top: 25rpx;
		float: left;
	}

	.reason_img image {
		width: 115rpx;
		height: 115rpx;
		background: #EEEEEE;
		margin-left: 14rpx;
	}

	.operation_log {
		width: 706rpx;
		height: 498rpx;
		background: #FFFFFF;
		opacity: 1;
		border-radius: 18rpx;
		margin: auto;
		margin-top: 25rpx;
	}

	.log_name {
		width: 481rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 1;
		padding-top: 25rpx;
		margin-left: 21rpx;
		float: left;
	}

	.log_seller {
		width: 126rpx;
		height: 50rpx;
		background: #FFFFFF;
		border: 1px solid #EEEEEE;
		opacity: 1;
		border-radius: 25rpx;
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 50rpx;
		color: #21201D;
		margin-right: 21rpx;
		margin-top: 25rpx;
		float: right;
		text-align: center;
	}

	.log_line {
		width: 643rpx;
		float: left;
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 0.35;
		margin-left: 21rpx;
		margin-top: 14rpx;
	}

	.del {
		text-decoration: line-through
	}

	.bottoms {
		width: 750rpx;
		height: 105rpx;
		background: #FFFFFF;
		opacity: 1;
		float: left;
		position: fixed;
		bottom: 0;
	}

	.btn {
		width: 699rpx;
		height: 79rpx;
		background: linear-gradient(206deg, #FCCA22 0%, #FFE246 100%);
		opacity: 1;
		border-radius: 39rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		text-align: center;
		line-height: 79rpx;
		margin: auto;
		margin-top: 12rpx;
	}

	.widths {
		width: 648rpx;
		height: 105rpx;
		border-bottom: 1rpx solid #EEEEEE;
		margin: auto;
	}

	.addrs {
		width: 750rpx;
		height: 905rpx;
		background: #FFFFFF;
		border-top-left-radius: 27rpx;
		border-top-right-radius: 27rpx;
	}

	.tops text {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 1;
		margin-top: 30rpx;
		margin-left: 288rpx;
		display: inline-block;
	}

	.tops image {
		width: 43rpx;
		height: 43rpx;
		float: right;
		margin-right: 21rpx;
		margin-top: 28rpx;
	}

	.comboxs {
		width: 706rpx;
		height: 79rpx;
		background: #F5F5F5;
		opacity: 1;
		border-radius: 7rpx;
		margin: auto;
		margin-top: 90rpx;
		text-align: left;
		text-indent: 21rpx;
	}

	.uni-input-placeholder {
		text-align: left;
		text-indent: 21rpx;
	}
	.uni-input-input{
		text-indent: 21rpx;
	}
	.puts {
		font-size: 21rpx;
		margin-top: 25rpx;
	}

	.addr_name {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 1;
		margin-top: 61rpx;
		margin-left: 21rpx;
		margin-bottom: 18rpx;
	}

	.addr_details {
		width: 706rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 1;
		margin-left: 21rpx;
	}

	.addr_infor {
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 0.65;
		margin-left: 21rpx;
		margin-top: 25rpx;
	}

	.btn {
		width: 699rpx;
		height: 79rpx;
		background: linear-gradient(206deg, #FCCA22 0%, #FFE246 100%);
		opacity: 1;
		border-radius: 39rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		text-align: center;
		line-height: 79rpx;
		margin: auto;
		position: fixed;
		bottom: 18rpx;
		left: 21rpx;
	}

	.arrowr {
		color: #000000;
		font-size: 21rpx;
		float: right;
		margin-top: -27rpx;
		margin-right: 34rpx;
		opacity: 0.35;
	}
	.refund_for {
		width: 699rpx;
		height: 101rpx;
		background: #FFFFFF;
		opacity: 1;
		border-radius: 18rpx;
		margin: auto;
		margin-top: 25rpx;
	}
	
	.for_amounts {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		line-height: 101rpx;
		color: #21201D;
		margin-left: 25rpx;
		opacity: 1;
	}
	
	.for_moneys {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #EB3E3E;
		opacity: 1;
		line-height: 101rpx;
		margin-right: 25rpx;
		float: right;
	}
	.fives{
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 1;
		margin-left: 25rpx;
		padding-top: 36rpx;
	}
	.customer_service{
		width: 340rpx;
		height: 79rpx;
		background: #21201D;
		opacity: 1;
		border-radius: 39rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FCDA22;
		text-align: center;
		line-height: 79rpx;
		float: left;
		margin-left: 25rpx;
		margin-top: 14rpx;
	}
	.again{
		width: 340rpx;
		height: 79rpx;
		background: linear-gradient(206deg, #FCCA22 0%, #FFE246 100%);
		opacity: 1;
		border-radius: 39rpx;
		font-size: 25rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		text-align: center;
		line-height: 79rpx;
		margin-top: 14rpx;
	}
</style>
